import type { AddressApiResult, AddressTokenApiResult } from "@/types/addressApi"
import { getAction, postAction, putAction, deleteAction, getBaiduApiAction, postBaiduApiAction } from "@/utils/http"
type data = {
    grant_type: string,
    client_id: string,
    client_secret: string
}
type token = {
    access_token: string
}

// 调用百度开放平台的地址信息识别提取接口
export const getAddressTokenApi = (data: data)=>{
    return getBaiduApiAction<AddressTokenApiResult>({
        url: 'https://aip.baidubce.com/oauth/2.0/token',
        data
    })
}
// 调用百度开放平台的地址信息识别提取接口
export const getAddressApi = (access_token: token, data: {text: string})=>{
    return postBaiduApiAction<AddressApiResult>({
        url: `https://aip.baidubce.com/rpc/2.0/nlp/v1/address?access_token=${access_token}}`,
        data
    })
}
